/*
* @Author: slp
* @Date:   2017-11-29 10:39:09
* @Last Modified by:   slp
* @Last Modified time: 2017-11-29 10:55:40
*/

#include <elf.h>

#include <stdio.h>


int main() {
	Elf64_Ehdr elf_header;
	FILE *f = fopen("ls", "rb");
	int rs = fread(&elf_header, sizeof(elf_header), 1, f);
	printf("read size: %d, %d\n", rs, sizeof(elf_header));
	printf("%s\n", (char *)&elf_header);
	printf("version: %d\n", elf_header.e_machine);
	printf("EM_NONE: %d\n", EM_NONE);
	printf("EM_M32: %d\n", EM_M32);
	printf("EM_SPARC: %d\n", EM_SPARC);
	printf("EM_386: %d\n", EM_386);
	printf("EM_68K: %d\n", EM_68K);
	printf("EM_88K: %d\n", EM_88K);
	printf("EM_860: %d\n", EM_860);
	printf("EM_MIPS: %d\n", EM_MIPS);
	printf("EM_PARISC: %d\n", EM_PARISC);
	printf("EM_SPARC32PLUS: %d\n", EM_SPARC32PLUS);
	// printf("SPARC: %d\n", SPARC);
	printf("EM_PPC: %d\n", EM_PPC);
	printf("EM_PPC64: %d\n", EM_PPC64);
	printf("EM_S390: %d\n", EM_S390);
	printf("EM_ARM: %d\n", EM_ARM);
	printf("EM_SH: %d\n", EM_SH);
	printf("EM_SPARCV9: %d\n", EM_SPARCV9);
	printf("EM_IA_64: %d\n", EM_IA_64);
	printf("EM_X86_64: %d\n", EM_X86_64);
	printf("EM_VAX: %d\n", EM_VAX);
    return 0;
}





















